package com.qf.shiro2202day02.user.utils;

import java.util.Random;

public class SaltUtils {
        /**
         * 生成salt的静态方法
         * @param n
         * @return
         */
        public static String getSalt(int n){
            char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890!@#$%^&*()".toCharArray();
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < n; i++) {
                char aChar = chars[new Random().nextInt(chars.length)];
                sb.append(aChar);
            }
            return sb.toString();
        }
    }


